#ifndef PP_FILE_H
#define PP_FILE_H

#include <string>
#include <vector>

namespace pp
{
// 针对c++17以下版本
//#if __cplusplus < 201703L
//#endif
#ifndef _WIN32

bool is_regular_file(const std::string& name);

bool is_directory(const std::string& name);

bool create_directories(const std::string& dirname);

class Path
{
private:
    std::string _filename;
public:
    Path(const std::string& filename) : _filename(filename) {}
    bool is_regular_file() const {return pp::is_regular_file(_filename);}
    const char* c_str() const {return _filename.c_str();}
    std::string extension() const;
    operator std::string() const {return _filename;}
};

class directory_entry
{
private:
    Path _path;
public:
    directory_entry(const Path& path) : _path(path) {}
    const Path& path() const {return _path;}
    bool is_regular_file() const {return _path.is_regular_file();}
};

std::vector<directory_entry> recursive_directory_iterator(const std::string& path);

#endif

};

#endif
